CC = gcc
DEBUG=-DDEBUG 
CFLAGS = -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs -fno-builtin $(DEBUG)
INCLUDES = -I./include
SRCS = kernel.c init/dt.c utils/io.c utils/string.c utils/bitmap.c utils/sorted_array.c mm/kmalloc.c mm/paging.c mm/kheap.c fs/vfs.c hw/console.c hw/interrupts.c hw/timer.c hw/keyboard.c hw/rtc.c time/time.c
ASMS = init/loader.s init/dt_install.s init/isr.s
BINDIR = ../bin
OBJS = $(ASMS:.s=.o) $(SRCS:.c=.o)

all: kernel

kernel: $(OBJS)
	cd $(BINDIR); ld -T ../src/link.ld -o kernel $(notdir $(OBJS))

.s.o:
	nasm -f elf -o $(BINDIR)/$(notdir $@) $<

.c.o:
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $(BINDIR)/$(notdir $@)


